package Correct;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;

import javax.swing.JTextArea;

import VWorldGameStudio.FCMap;
import utils.FCDataSingles;

public class CorrectFunction {

	public boolean startcorrect(JTextArea text, int num) {
		switch (num) {
		case 0:
			return test(text);
		default:
			return false;
		}
	}

	public boolean test(JTextArea text) {
		text.append("----->test->start\n");
		for (int i = 0; i < 100; i++) {
			text.append(i + ":该行为第" + (i + 1) + "条数据修复提示！\n");
			text.setCaretPosition(text.getText().length());
		}
		return true;
	}

	public boolean correctMapEntityData(JTextArea text) {
		try {
			text.append("----->修复地图实体数据->start\n");
			BufferedReader ff = new BufferedReader(new FileReader(new File("./data/maplist.vw")));
			String ss = ff.readLine();
			while (ss != null) {
				FCMap map = FCDataSingles.getReader().readMapData(0, "./data/map/" + ss);
				ss = ff.readLine();
			}
			return true;
		} catch (Exception e) {
			return false;
		}
	}
}